package com.hzf.material.dao.model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

public class MaterialGoods implements  Comparable,Serializable {
    /**
     * 商品表ID（自增）
     *
     * @mbg.generated
     */
    private Integer goodsId;

    /**
     * 商品名称
     *
     * @mbg.generated
     */
    private String goodsName;

    /**
     * 商品数量
     *
     *
     *
     * @mbg.generated
     */
    private Integer amount;

    /**
     * 商品单位
     *
     * @mbg.generated
     */
    private String unit;



    /**
     * 是否带安装（0：不带  1：带）
     *
     * @mbg.generated
     */
    private Integer hasInstall;

    /**
     * 安装费用
     *
     * @mbg.generated
     */
    private double installPrice;

    /**
     * 商品描述
     *
     * @mbg.generated
     */
    private String description;

    /**
     * 所属大类
     *
     * @mbg.generated
     */
    private Integer typeBigId;

    /**
     * 所属中类
     *
     * @mbg.generated
     */
    private Integer typeMiddleId;

    /**
     * 所属小类
     *
     * @mbg.generated
     */
    private Integer typeSmallId;

    /**
     * 用户表外键Id
     *
     * @mbg.generated
     */
    private Integer useId;
    /**
     * 店铺外键Id
     *
     * @mbg.generated
     */
    private Integer shopId;

    /**
     * 备注
     *
     * @mbg.generated
     */
    private String remark;

    /**
     * 是否开启拼单（0：未开 1：已开）
     *
     * @mbg.generated
     */
    private Integer isOpenpin;

    /**
     * 产品销量
     *
     * @mbg.generated
     */
    private Integer sales;

    /**
     * 状态0：商品上架，1：商品下架
     *
     * @mbg.generated
     */
    private Integer status;

    /**
     * 经度
     *
     * @mbg.generated
     */
    private double lng;

    /**
     * 维度
     *
     * @mbg.generated
     */
    private double lat;

    private Long geoCode;
    private double distanceKm;

    private List<MaterialGoodsModel> dilectModel;

    private MaterialGoodsModelPin materialGoodsModelPin;//通用拼单参数

    private List<MaterialGoodsModelPin> materialGoodsModelPins;//所有参与拼单的型号的详情


    private MaterialGoodsModel model;//单一型号的录入

    private List<MaterialGoodsModel> modelList;//所有型号
    private List<MaterialGoodsModel> pinmodelList;//所有拼单型号


    private MaterialGoodsTypeSmall materialGoodsTypeSmall;

    private MaterialGoodsTypeMiddle materialGoodsTypeMiddle;

    private MaterialGoodsTypeBig materialGoodsTypeBig;

    private static final long serialVersionUID = 1L;

    public Integer getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(Integer goodsId) {
        this.goodsId = goodsId;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public Integer getAmount() {
        return amount;
    }

    public void setAmount(Integer amount) {
        this.amount = amount;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }



    public Integer getHasInstall() {
        return hasInstall;
    }

    public void setHasInstall(Integer hasInstall) {
        this.hasInstall = hasInstall;
    }

    public double getInstallPrice() {
        return installPrice;
    }

    public void setInstallPrice(double installPrice) {
        this.installPrice = installPrice;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getTypeBigId() {
        return typeBigId;
    }

    public void setTypeBigId(Integer typeBigId) {
        this.typeBigId = typeBigId;
    }

    public Integer getTypeMiddleId() {
        return typeMiddleId;
    }

    public void setTypeMiddleId(Integer typeMiddleId) {
        this.typeMiddleId = typeMiddleId;
    }

    public Integer getTypeSmallId() {
        return typeSmallId;
    }

    public void setTypeSmallId(Integer typeSmallId) {
        this.typeSmallId = typeSmallId;
    }

    public Integer getUseId() {
        return useId;
    }

    public void setUseId(Integer useId) {
        this.useId = useId;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Integer getIsOpenpin() {
        return isOpenpin;
    }

    public void setIsOpenpin(Integer isOpenpin) {
        this.isOpenpin = isOpenpin;
    }

    public Integer getSales() {
        return sales;
    }

    public void setSales(Integer sales) {
        this.sales = sales;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getShopId() {
        return shopId;
    }

    public void setShopId(Integer shopId) {
        this.shopId = shopId;
    }

    public List<MaterialGoodsModel> getModelList() {
        return modelList;
    }

    public void setModelList(List<MaterialGoodsModel> modelList) {
        this.modelList = modelList;
    }

    public MaterialGoodsModel getModel() {
        return model;
    }

    public void setModel(MaterialGoodsModel model) {
        this.model = model;
    }

    public MaterialGoodsModelPin getMaterialGoodsModelPin() {
        return materialGoodsModelPin;
    }

    public void setMaterialGoodsModelPin(MaterialGoodsModelPin materialGoodsModelPin) {
        this.materialGoodsModelPin = materialGoodsModelPin;
    }

    public List<MaterialGoodsModelPin> getMaterialGoodsModelPins() {
        return materialGoodsModelPins;
    }

    public void setMaterialGoodsModelPins(List<MaterialGoodsModelPin> materialGoodsModelPins) {
        this.materialGoodsModelPins = materialGoodsModelPins;
    }

    public MaterialGoodsTypeSmall getMaterialGoodsTypeSmall() {
        return materialGoodsTypeSmall;
    }

    public void setMaterialGoodsTypeSmall(MaterialGoodsTypeSmall materialGoodsTypeSmall) {
        this.materialGoodsTypeSmall = materialGoodsTypeSmall;
    }

    public MaterialGoodsTypeMiddle getMaterialGoodsTypeMiddle() {
        return materialGoodsTypeMiddle;
    }

    public void setMaterialGoodsTypeMiddle(MaterialGoodsTypeMiddle materialGoodsTypeMiddle) {
        this.materialGoodsTypeMiddle = materialGoodsTypeMiddle;
    }

    public MaterialGoodsTypeBig getMaterialGoodsTypeBig() {
        return materialGoodsTypeBig;
    }

    public void setMaterialGoodsTypeBig(MaterialGoodsTypeBig materialGoodsTypeBig) {
        this.materialGoodsTypeBig = materialGoodsTypeBig;
    }

    public List<MaterialGoodsModel> getDilectModel() {
        return dilectModel;
    }

    public void setDilectModel(List<MaterialGoodsModel> dilectModel) {
        this.dilectModel = dilectModel;
    }

    public List<MaterialGoodsModel> getPinmodelList() {
        return pinmodelList;
    }

    public void setPinmodelList(List<MaterialGoodsModel> pinmodelList) {
        this.pinmodelList = pinmodelList;
    }

    public double getLng() {
        return lng;
    }

    public void setLng(double lng) {
        this.lng = lng;
    }

    public double getLat() {
        return lat;
    }

    public void setLat(double lat) {
        this.lat = lat;
    }

    public void setGeoCode(long geoCode) {
        this.geoCode = geoCode;
    }

    public long getGeoCode() {
        return geoCode;
    }

    public void setGeoCode(Long geoCode) {
        this.geoCode = geoCode;
    }

    public double getDistanceKm() {
        return distanceKm;
    }

    public void setDistanceKm(double distanceKm) {
        this.distanceKm = distanceKm;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", goodsId=").append(goodsId);
        sb.append(", goodsName=").append(goodsName);
        sb.append(", amount=").append(amount);
        sb.append(", unit=").append(unit);

        sb.append(", hasInstall=").append(hasInstall);
        sb.append(", installPrice=").append(installPrice);
        sb.append(", description=").append(description);
        sb.append(", typeBigId=").append(typeBigId);
        sb.append(", typeMiddleId=").append(typeMiddleId);
        sb.append(", typeSmallId=").append(typeSmallId);
        sb.append(", useId=").append(useId);
        sb.append(", remark=").append(remark);
        sb.append(", isOpenpin=").append(isOpenpin);
        sb.append(", sales=").append(sales);
        sb.append(", status=").append(status);
        sb.append(", shopId=").append(shopId);

        sb.append("]");
        return sb.toString();
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        MaterialGoods other = (MaterialGoods) that;
        return (this.getGoodsId() == null ? other.getGoodsId() == null : this.getGoodsId().equals(other.getGoodsId()))
            && (this.getGoodsName() == null ? other.getGoodsName() == null : this.getGoodsName().equals(other.getGoodsName()))
            && (this.getAmount() == null ? other.getAmount() == null : this.getAmount().equals(other.getAmount()))
            && (this.getUnit() == null ? other.getUnit() == null : this.getUnit().equals(other.getUnit()))

            && (this.getHasInstall() == null ? other.getHasInstall() == null : this.getHasInstall().equals(other.getHasInstall()))
            && (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()))
            && (this.getTypeBigId() == null ? other.getTypeBigId() == null : this.getTypeBigId().equals(other.getTypeBigId()))
            && (this.getTypeMiddleId() == null ? other.getTypeMiddleId() == null : this.getTypeMiddleId().equals(other.getTypeMiddleId()))
            && (this.getTypeSmallId() == null ? other.getTypeSmallId() == null : this.getTypeSmallId().equals(other.getTypeSmallId()))
            && (this.getUseId() == null ? other.getUseId() == null : this.getUseId().equals(other.getUseId()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
            && (this.getIsOpenpin() == null ? other.getIsOpenpin() == null : this.getIsOpenpin().equals(other.getIsOpenpin()))
            && (this.getSales() == null ? other.getSales() == null : this.getSales().equals(other.getSales()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getGoodsId() == null) ? 0 : getGoodsId().hashCode());
        result = prime * result + ((getGoodsName() == null) ? 0 : getGoodsName().hashCode());
        result = prime * result + ((getAmount() == null) ? 0 : getAmount().hashCode());
        result = prime * result + ((getUnit() == null) ? 0 : getUnit().hashCode());
        result = prime * result + ((getHasInstall() == null) ? 0 : getHasInstall().hashCode());
        result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
        result = prime * result + ((getTypeBigId() == null) ? 0 : getTypeBigId().hashCode());
        result = prime * result + ((getTypeMiddleId() == null) ? 0 : getTypeMiddleId().hashCode());
        result = prime * result + ((getTypeSmallId() == null) ? 0 : getTypeSmallId().hashCode());
        result = prime * result + ((getUseId() == null) ? 0 : getUseId().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getIsOpenpin() == null) ? 0 : getIsOpenpin().hashCode());
        result = prime * result + ((getSales() == null) ? 0 : getSales().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        return result;
    }
    @Override
    public int compareTo(Object o) {
        MaterialGoods p = (MaterialGoods) o;
        if(p.distanceKm<this.distanceKm){
            return 1;
        }
        else if(p.distanceKm>this.distanceKm){
            return -1;
        }
        else{
            return 0;
        }

    }
}